<?php

class ScanLogCommand extends CConsoleCommand {
	
	public function run($args) {
		// Get all log resources
		$resourcePartions = array();
		$resService = ResourceService::getInstance();
		$logResources = Resource::listItems(ResourceType::Log);
		$hdfsUtil = new HdfsUtil();
		
		foreach ($logResources as $logResource) {
			$logPhysical = $resService->getResourcePhysicalByType($logResource['res_id'], PhysicalType::Hdfs);
			if(!isset($logPhysical)) {
				Yii::log("log resource[{$logResource['res_name']}] don't have physical resource", CLogger::LEVEL_ERROR);
				continue;
			}
			
			$resourcePartions[] = $resService->getPartitions($logPhysical['physical_id']);
			// Scan the resource physical dir
			$files = $hdfsUtil->readDir($path);
			foreach($files as $file) {
				if($file->isdir) {
					
				}
			}
		}
	}
}